import { CHOOSE_STORE, LOAD_FIELDS, CHOOSE_TIME, CLEAR_STORE_AND_TIME } from '../actionTypes'
const initialState = {};

export default function(state = initialState, action) {
  switch (action.type) {
    case CHOOSE_STORE: {

      state.currentStore = action.payload.currentStore
      state.actionType = action.payload.actionType
      
      return Object.assign({},state)
    }
    case CHOOSE_TIME: {
      state.gameTime = {
        game: action.payload.game,
        mode: action.payload.mode,
        field: action.payload.field
      }
      return Object.assign({},state)
    }

    case CLEAR_STORE_AND_TIME: {
      state.currentStore = null
      state.gameTime = null
      return Object.assign({},state)
    }
    default:
      return state
  }
}
